package com.exp.irorichat.controller;


import com.exp.irorichat.entity.requst.UserReq;
import com.exp.irorichat.result.Result;
import com.exp.irorichat.service.UserService;
import com.exp.irorichat.valid.AddGroup;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import javax.validation.Valid;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author universe7427
 * @since 2024-12-10
 */
@RestController
@RequestMapping("/user")
@Api(tags = "用户相关接口")
@Slf4j
public class UserController {

    @Autowired
    private UserService userService;


    @ApiOperation("用户注册")
    @PostMapping("/addUser")
    public Result addUser(@Validated({AddGroup.class}) @RequestBody UserReq userReq) {
        userService.addUser(userReq);
        return Result.ok();
    }

}

